package main

import (
	"fmt"
	"strconv"
)

func compressString(s string) string {
	compressed := ""
	count := 1

	for i := 0; i < len(s); i++ {
		if i+1 < len(s) && s[i] == s[i+1] {
			count++
		} else {
			compressed += string(s[i]) + strconv.Itoa(count)
			count = 1
		}
	}
	return compressed
}

func main() {
	var input string
	fmt.Println("请输入一个字符串")
	fmt.Scanln(&input)
	fmt.Println("原始字符串：", input)
	fmt.Println("压缩后的字符串：", compressString(input))
}

